package com.byl.common.config;

import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.MultipartConfigElement;

/**
 * Created by Administrator on 2019/12/17.
 */
@Configuration
public class FileUploadConfig {
    /**
     * 文件上传配置
     *
     * @return
     */
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //  单个数据大小
        factory.setMaxFileSize("2024000KB"); // KB,MB
        /// 总上传数据大小
        factory.setMaxRequestSize("2024000KB");
        return factory.createMultipartConfig();
    }
}
